package com.zhanggm.s3.house.elasticsearch;

import com.zhanggm.s3.house.entity.HouseAnjuke;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Highlight;
import org.springframework.data.elasticsearch.annotations.HighlightField;
import org.springframework.data.elasticsearch.annotations.HighlightParameters;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;


public interface HouseAnjukeRepository extends ElasticsearchRepository<HouseAnjuke,String> {


    /*@Highlight(
            fields = {@HighlightField(name = "title"), @HighlightField(name = "detailItem"),@HighlightField(name = "detailItemTag"),@HighlightField(name = "detailItemBotTag")},
            parameters = @HighlightParameters(preTags = {"<span style='color:red'>"}, postTags = {"</span>"}, numberOfFragments = 0)
    )*/
    Page<HouseAnjuke> findAllByTitleOrDetailItemOrDetailItemBotTagOrAndDetailItemTag(String title,String t2,String t3,String t4, Pageable pageable);

    @Highlight(
            fields = {@HighlightField(name = "title")},
            parameters = @HighlightParameters(preTags = {"<span style='color:red'>"}, postTags = {"</span>"})
    )
    Page<HouseAnjuke> findByTitle(String title,Pageable pageable);


    List<HouseAnjuke> findByDetailItemAndDetailItemBotTag(String detailItem,String detailItemBotTag);

}
